<template>
	<view class="content">
		<view class="navBar">
			<view class="left">
				<navigator url="../all-activities/all-activities" open-type="switchTab">
					<uni-icons class="right-icon" type="arrowleft" size="20" color="#fff"></uni-icons>
				</navigator>
			</view>
			<view class="center">
				<text class="uni-tab-item-title">{{name}}</text>
			</view>
			<view class="right">
				<uni-icons class="right-icon" type="redo" size="20" color="#fff"></uni-icons>
			</view>
		</view>
		<view class="top"  :style="{backgroundImage:'url('+backurl+')'}">
			<view class="choose-new-hot" >
				<text v-for="(item,index) in chooseItems" @click="onClickItem" :id="index"  class="new-hot" :class="chooseIndex == index ? 'new-hot-active' : ''">{{item}}</text>
			</view>
		</view>
		<view class="new" v-if="chooseIndex == 0">
			<view class="author" v-for="(item,index) in authorInfo">
				<view><image :src="item.Imageurl"></image></view>
				<view class="author-info">{{exDetail.auIntro}}</view>
			</view>
		</view>
		<view class="hot" v-if="chooseIndex == 1">
			<view class="author" v-for="(item,index) in artDetail">
				<view style="margin-top: 100rpx;"><image :src="item.artImg"></image></view>
				<view class="author-info">{{item.artName}}</view>
				<view class="author-info">{{item.artIntro}}</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default{
		onLoad() {
			this.getAuthorDetail(1);
			this.getArtDetail(1,1,5);
		},
		data(){
			return{
				exDetail:{},
				artDetail:[],
				name:'“业火的向日葵”梵高画展',
				backurl:'../../../static/online-watch/20.jpg',
				chooseItems:['作者介绍','作品展示'],
				chooseIndex:0,
				authorInfo:[
					{
						id:1,
						Imageurl:"../../../static/swiper/1.jpg",
						describe:"这幅油画是我画的向日葵，模仿了梵高的画风，创作不易，希望大家多多投票支持",
					},
					{
						id:2,
						Imageurl:"../../../static/swiper/2.jpg",
						describe:"这幅油画是我画的向日葵，模仿了梵高的画风，创作不易，希望大家多多投票支持",
					},
					{
						id:3,
						Imageurl:"../../../static/swiper/3.jpg",
						describe:"这幅油画是我画的向日葵，模仿了梵高的画风，创作不易，希望大家多多投票支持",
					},
					{
						id:4,
						Imageurl:"../../../static/swiper/4.jpg",
						describe:"这幅油画是我画的向日葵，模仿了梵高的画风，创作不易，希望大家多多投票支持",
					}
				]
			}
		},
		methods:{
			onClickItem(e) {
				this.chooseIndex = e.currentTarget.id
			},
			getAuthorDetail(exId){
				uni.request({
					url:"http://ronin.fun:8888/ex/detail/author",
					data:{
						exId:exId
					},
					success: (res) => {
						this.exDetail = res.data.data;
						console.log(this.exDetail);
					}
				})
			},
			getArtDetail(exId,current,size){
				uni.request({
					url:"http://ronin.fun:8888/ex/detail/art",
					data:{
						exId:exId,
						current:current,
						size:size
					},
					success: (res) => {
						this.artDetail = res.data.data.records;
						console.log(this.artDetail);
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.content{
		width: 100%;
		height: 100%;
		// 导航栏
		.navBar{
			z-index: 1000;
			position: fixed;
			width: 100%;
			height: 90rpx;
			display: flex;
			// background-color: #B0E3FF;
			.left{
				display: inline-block;
				height: 100%;
				width: 200rpx;
				.right-icon{
					margin-left: 20rpx;
					line-height: 90rpx;
				}
			}
			.center{
				display: inline-block;
				height: 100%;
				flex: 1;
				text-align: center;
				line-height: 90rpx;
				.uni-tab-item {
					/* #ifndef APP-PLUS */
					display: inline-block;
					/* #endif */
					flex-wrap: nowrap;
					padding-left: 10rpx;
					padding-right: 10rpx;
				}
				.uni-tab-item-title {
					color: #FFFFFF;
					font-size: 30rpx;
					font-weight: bold;
					height: 80rpx;
					line-height: 80rpx;
					flex-wrap: nowrap;
					/* #ifndef APP-PLUS */
					white-space: nowrap;
					/* #endif */
				
				}
				.uni-tab-item-title-active {
					color: #FFFFFF;
					font-weight: bold;
					font-size: 40rpx;
					// border-bottom: solid #797979;
				}
			}
			.right{
				display: inline-block;
				height: 100%;
				width: 200rpx;
				text-align: center;
				align-items: center;
				.right-icon{
					margin-left: 20rpx;
					line-height: 90rpx;
				}
			}
			
		}
		// .backimg{
		// 	width: 100%;
		// 	height: 100%;
		// 	image{
		// 		width: 100%;
		// 		height: 100%;
		// 	}
		// }
		.top{
			width: 100%;
			height: 500rpx;
			position: relative;
			.choose-new-hot{
				width: 100%;
				height: 70rpx;
				margin-top: 20rpx;
				position: absolute;
				display: flex;
				bottom: 0;
				text-align: center;
				.new-hot{
					color: #FFFFFF;
					font-size: 40rpx;
					display: inline-block;
					flex: 1;
					
				}
				.new-hot-active{
					color: #B0E3FF;
					font-size: 40rpx;
					font-weight: bold;
					display: inline-block;
					flex: 1;
				}
			}
		}
		.author{
			width: 100%;
			text-align: center;
			margin-top: 30rpx;
			margin-bottom: 10rpx;
			.author-info{
				margin-top: 20rpx;
				margin-left: 20rpx;
				margin-right: 20rpx;
			}
		}
		
	}
</style>
